<template>
	<view class="">
		<u-sticky bgColor="#ffffff">
			<view class="mainpadding flexbetween">
				<view class="ershiba nofonweight xiaolv">选择时间后查询</view>
				<view class="flexright" @click="messageTime.timeShow = true;timevalue=4">
					<input class="textright" type="text" placeholder="请选择" disabled="" v-model="time">
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
		</u-sticky>
		<view class="mainpadding2">
			<view class="flexcenter" v-if="!list.data.length">
				<view class="placeholderimage" style="margin-top: 300rpx;" ></view>
			</view>
			<view class="mainpadding radius ffffff margin_top" v-for="item in list.data" :key="item.id">
				<view class="">
					<view class="sanshier xiaohei fonweight">{{item.kcorder.name}}</view>
					<view class="ershiba xiaolv margin_top2 fonweight">{{item.sk_time_text}}  {{item.kckcb.start_time}}-{{item.kckcb.end_time}}</view>
					<view class="ershiba xiaohui margin_top2 fonweight">{{item.kc.address}}</view>
					<view class="ershiba xiaohui margin_top2 fonweight">{{item.kckcb.jlinfo.name}}</view>
				</view>
			</view>
		</view>
		<timePicker :messageTime="messageTime" @timeConfirm="timeConfirm"></timePicker>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")

	export default {
		data() {
			return {
				page: 1,
				limit: 18,
				list: {
					data: []
				},
				listid:"",
				messageTime:{
					timeShow:false,
					title:"选择时间",
					mode:"date"//date日期，datetime年月日时分秒，time时间
				},
				time:""
			}
		},
		onLoad(options) {
			this.listid = options.id
		},
		methods: {
			timeConfirm(e){
				this.time = e
				this.init()
			},
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit,
					jl_user_zbfapply_id:this.listid,
					date:this.time,
				}
				let url = 'api/kccl/jlKcKcb'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.xiaohbtn {
		width: 112rpx;
		height: 44rpx;
		background: #F76222;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		font-size: 24rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.xiaolbtn {
		width: 112rpx;
		height: 44rpx;
		background: #1BA95B;
		border-radius: 24rpx 24rpx 24rpx 24rpx;
		font-size: 24rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	page {
		background: #F9F9F9;
	}
</style>